import request from '@/utils/request';

// 获取推荐列表
export function queryRecommendList(body: API.RecommendParam) {
	return request<API.RecommendResponse[]>({
		url: '/api/tasks',
		method: 'GET',
		body
	});
}

// 收藏
export function queryCollectTask(taskId: string) {
	return request<API.CollectResponse[]>({
		url: `/api/tasks/${taskId}/collects`,
		method: 'POST'
	});
}

// 点赞
export function queryLikeTask(taskId: string) {
	return request<API.LikeResponse[]>({
		url: `/api/tasks/${taskId}/likes`,
		method: 'POST'
	});
}

// 取消收藏
export function cancelCollectTask(taskId: string) {
	return request<API.CollectResponse[]>({
		url: `/api/tasks/${taskId}/collects`,
		method: 'DELETE'
	});
}

// 取消点赞
export function cancelLikeTask(taskId: string) {
	return request<API.LikeResponse[]>({
		url: `/api/tasks/${taskId}/likes`,
		method: 'DELETE'
	});
}

// 获取详情
export function queryDetail(taskId: string | number) {
	return request<API.RecommendResponse>({
		url: `/api/tasks/${taskId}/details`,
		method: 'GET'
	});
}

// 求解者获取用户列表
export function querySolverList(body: API.SolverListRequestParam) {
	return request<API.SolverListResponse[]>({
		url: `/api/solverUsers`,
		method: 'GET',
		body
	});
}
